#include <iostream>
using namespace std;
int main()
{
    int con,n1,n2,n3,n4,a,b,c,d;
    cin>>n1;
    cin>>n2;
    cin>>n3;
    cin>>n4;
    cout<<"Ingrese otros numeros"<<endl;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    con=0;

    if (n1==a||n1==b||n1==c||n1==d)
    {
        con=con+1;
    }
            if (n2==a||n2==b||n2==c||n2==d)
    {
        con=con+1;
    }

        if (n3==a||n3==b||n3==c||n3==d)
    {
        con=con+1;
    }
            if (n4==a||n4==b||n4==c||n4==d)
    {
        con=con+1;
    }

    cout<<con;
return 1;
}
